package com.iking.housekeeping.controller.parameter;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iking.housekeeping.common.CodeEnum;
import com.iking.housekeeping.common.ReturnCode;
import com.iking.housekeeping.httpbean.view.ChangeServiceBean;
import com.iking.housekeeping.httpbean.view.ChargeTypeBean;
import com.iking.housekeeping.httpbean.view.GenderBean;
import com.iking.housekeeping.httpbean.view.IsChangeServiceBean;
import com.iking.housekeeping.httpbean.view.RegionalTypeBean;
import com.iking.housekeeping.httpbean.view.ServiceStateBean;
import com.iking.housekeeping.service.parameter.ParameterService;

/**
 *
 * @author cgz
 * @version 创建时间：2018年4月27日 下午2:16:44
 * 
 */
@RestController
@RequestMapping("/parameter")
public class ParameterController {

	@Autowired
	private ParameterService parameterService;

	/**
	 * 
	 * @Description:查询是否更改服务
	 * @author:CGZ
	 * @return
	 */
	@GetMapping("/selectischangeservice")
	public ReturnCode selectischangeservice() {
		List<IsChangeServiceBean> isChangeServiceBean = parameterService.selectIsChangeServiceBean();
		if(isChangeServiceBean.size() <0) {
			return new ReturnCode(CodeEnum.FAIL, null);
		}
		return new ReturnCode(CodeEnum.SUCCESS, isChangeServiceBean);
	}
	
	@GetMapping("/selectchangeservice")
	public ReturnCode selectchangeservice() {
		List<ChangeServiceBean> changeServiceBean = parameterService.selectChangeServiceBean();
		if(changeServiceBean.size() <0) {
			return new ReturnCode(CodeEnum.FAIL, null);
		}
		return new ReturnCode(CodeEnum.SUCCESS, changeServiceBean);
	}
	
	@GetMapping("/selectchargetype")
	public ReturnCode selectchargetype() {
		List<ChargeTypeBean> chargeTypeBean = parameterService.selectchargetypeBean();
		if(chargeTypeBean.size() <0) {
			return new ReturnCode(CodeEnum.FAIL, null);
		}
		return new ReturnCode(CodeEnum.SUCCESS, chargeTypeBean);
	}
	
	@GetMapping("/selectgender")
	public ReturnCode selectgender() {
		List<GenderBean> genderBean = parameterService.selectGenderBeanBean();
		if(genderBean.size() <0) {
			return new ReturnCode(CodeEnum.FAIL, null);
		}
		return new ReturnCode(CodeEnum.SUCCESS, genderBean);
	}
	
	@GetMapping("/selectregionaltype")
	public ReturnCode selectregionaltype() {
		List<RegionalTypeBean> regionalTypeBean = parameterService.selectRegionalTypeBeanBean();
		if(regionalTypeBean.size() <0) {
			return new ReturnCode(CodeEnum.FAIL, null);
		}
		return new ReturnCode(CodeEnum.SUCCESS, regionalTypeBean);
	}
	
	@GetMapping("/selectservicestate")
	public ReturnCode selectservicestate() {
		List<ServiceStateBean> serviceStateBean = parameterService.selectServiceStateBeanBean();
		if(serviceStateBean.size() <0) {
			return new ReturnCode(CodeEnum.FAIL, null);
		}
		return new ReturnCode(CodeEnum.SUCCESS, serviceStateBean);
	}
}
